package com.example.orderfoodsystem22201310liuziming.repository;

import com.example.orderfoodsystem22201310liuziming.entity.foodmenu;
import com.example.orderfoodsystem22201310liuziming.entity.shoppingcart;
import org.springframework.data.repository.CrudRepository;

import javax.transaction.Transactional;
import java.util.Optional;

public interface CartRepository extends CrudRepository<shoppingcart,Integer> {
    @Transactional
    void deleteByFoodname(String Name);

    shoppingcart findByFoodname(String Name);
    shoppingcart findByUsernameAndFoodID(String username, int foodID);
    Iterable<shoppingcart> findAllByUsername(String username); //可枚举

    @Transactional
    void deleteAllByUsername(String username);
}
